package org.itsolutions.javaBackup.ftp;

import java.util.concurrent.atomic.AtomicBoolean;

import org.itsolutions.javaBackup.exceptions.AException;
import org.itsolutions.javaBackup.logger.ELogLevel;
import org.itsolutions.javaBackup.logger.ILogger;
import org.itsolutions.javaBackup.logger.LoggerHelper;
import org.itsolutions.javaBackup.spi.EModule;
import org.itsolutions.javaBackup.spi.IModuleStartStopTask;

/**
 * 
 * @author Tomas Fecko
 */
public final class FTPModuleStartStopTask implements IModuleStartStopTask {

	private static final ILogger LOGGER = LoggerHelper.getLogger(FTPModuleStartStopTask.class);
	private static final AtomicBoolean	IS_STARTED = new AtomicBoolean(false);

	@Override
	public void start() throws AException {
		LOGGER.log(ELogLevel.DEBUG, "FTPModuleStartStopTask starting.");
		IS_STARTED.set(true);		
	}

	@Override
	public void stop() throws AException {
		LOGGER.log(ELogLevel.DEBUG, "FTPModuleStartStopTask stopping.");
		IS_STARTED.set(false);		
	}

	@Override
	public boolean isStarted() throws AException {
		return IS_STARTED.get();
	}

	@Override
	public EModule getModule() {
		return EModule.FTP;
	}
}
